#! /usr/bin/python
import math

counter =0
for n in range(2, 10001):
    a0 = math.floor(math.sqrt(n))
    if n == a0**2: continue
    else: 
        b=firstB = n-a0**2
        r=firstR = int(2*a0/firstB)*firstB-a0
    length = 0
    while(1):        
	if (n -r**2)%b == 0: nextB = (n -r**2)/b
        else: nextB = n -r**2
        nextR = int((a0+r)/nextB)*nextB-r
        b = nextB
        r = nextR
        length +=1
        if firstB == b and firstR == r:break
    if length%2 != 0: counter+=1 
    #print length  
print counter
        
